import axios from "./index";
function wrapGetParams(url,data){
    if(data){
        if(data instanceof String){
            return url+data;  
        }else{
            var params =[];
            for(var p in data){
                    params.push(p+"="+data[p]);
            }
           var ps = "?"+params.join("&");
           return url+ps;  
        }
    }
}
function wrapPostParams(data){
    if(data){
        if(data instanceof String){
            return data;  
        }else{
            var params =[];
            for(var p in data){
                    params.push(p+"="+data[p]);
            }
           var ps = params.join("&");
           return ps;  
        }
    }
}
export function importQuestion(data) {
    return   axios.get(wrapGetParams("/xxx",data)) ;
    
}
export function addUser(data){
    
    return axios.put("/api/user/addUser",wrapPostParams(data),{headers:{'Content-Type':'application/x-www-form-urlencoded'}});  
}
export function findUser(data){
    return axios.post("/api/user/findUser",data);  
}

//登录
export function login(data) {
    return axios.post("/api/user/loginByAccountAndPassword",wrapPostParams(data),{headers:{'Content-Type':'application/x-www-form-urlencoded'}});  
}



